<%@page import="java.io.Console"%>
<%@ page language="java" contentType="text/html; charset=utf-8" import="com.zsf.pojo.*,java.util.List"
    pageEncoding="utf-8"%>
    <%List products=(List)request.getAttribute("products"); 
      List tags=(List)request.getSession().getAttribute("tags");
    %>
    
<!DOCTYPE html>
<html lang="zh-CN">
  <head>
	<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
	<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
 	<meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
	<script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
	<title>轻课商城</title>
  </head>
  <body style="margin: 0 auto;text-align: center;">
	<nav class="navbar navbar-default">
  <div class="container-fluid">
    <div class="navbar-header">
      <a class="navbar-brand" href="#">轻课商城</a>
    </div>
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1" >
      <ul class="nav navbar-nav">
        <li class="active"><a href="#">首页 <span class="sr-only">(current)</span></a></li>
        <li><a href="#">热销榜</a></li>
      </ul>
      <ul class="nav navbar-nav navbar-right">
        <li><a href="#">个人中心</a></li>
        <li class="dropdown">
          <a href="addProduct.jsp" class="dropdown-toggle">
          	添加商品</a>
        </li>
      </ul>
    </div>
  </div>
</nav>
	<div style="width: 80%;margin:0 auto;text-align: center; " >
		<nav class="">
		  <div class="container-fluid" style="margin-top: 0">
		    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1" >
		      <form class="navbar-form navbar-left" action="seacher">
		        <div class="form-group" >
		          <input type="text"  class="form-control" placeholder="请输入您要查找的商品名称" name="title" size="60">
		        </div> 
		        <div class="form-group">
		        <select class="form-control" name="tag"> 
		        <option value="0" selected = "selected">分类</option>
		        <%if(tags.size()!=0){
		        for(int i=0;i<tags.size();i++) {
		        	Tag tag=(Tag)tags.get(i);
		        %>
		        <option value=<%=i+1%>><%=tag.getName()%></option>
		         <%}}%>
		         </select> 
		         </div>
		        <button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-search" aria-hidden="true"></span></button>
		      </form>
		    </div>
		  </div>
		</nav>
		<br/><br/><br/>	
		<div class="row" >
		 	<% if(products.size()!=0){ 
		 	Product product;
			for(Object obj:products){
				product=(Product)obj;%>
			  <div class="col-xs-6 col-md-2" style="display: inline; width: 220px; height: 430;overflow:hidden;">
			    <div class="thumbnail">
			      <img src=<%=product.getImgPath()%> alt=<%=product.getTitle() %> width="180px" height="180px">
			      <div class="caption" style="text-align: center;">
			     	 <h4><%=product.getTitle()%></h4>
			        <p>跳楼价：<%=product.getPrice()%></p>
			        <p>剩余：<%=product.getTotalNum()%></p>
			        <br/>
			        <p><a href="#" class="btn btn-primary" role="button">立即购买</a><br/><br/>
			         <a href="#" class="btn btn-default" role="button">加入购物车</a></p>
			      </div>
			    </div>
			  </div>
			 <%}%>
			  <%}else{%>
			  	<p>暂无此商品，请等待商品上架</p>
			  <%}%>
			 </div>
	  </div>
<script
		src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"
		integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
		crossorigin="anonymous"></script>
  </body>
</html>